#
study_name = 'study_mr_spla_02'
#
import numpy as np
#
if __name__ == '__main__':
    source_python = r'\\MA-CASTRO\abaqus-conecyl-python'
    import sys
    import os
    study_dir  = os.path.join( r'C:\Temp','abaqus',study_name )
    if not os.path.isdir( study_dir ):
        os.makedirs( study_dir )
    python_dir = os.path.join( study_dir, 'abaqus-conecyl-python' )
    output_dir = os.path.join( study_dir,'outputs' )
    print 'configuring folders...'
    print '\t' + python_dir
    print '\t' + output_dir
    if not os.path.isdir( output_dir ):
        os.makedirs( output_dir )
    if not os.path.isdir( python_dir ):
        os.makedirs( python_dir )
    os.system('copy ' + source_python + ' ' + python_dir + '') 
    sys.path.append( python_dir )
    #
    import study
    study = reload( study )
    from study import Study
    std = Study()
    std.name = study_name
    std.rebuild()
    #
    ccnames = [\
               #'r_100_h_200',
               #'r_200_h_400',
               'r_400_h_800',
               #'r_100_h_800', #slender
               'r_400_h_200', #short
              ]
    ploads = {\
              'pl_025':  25.  ,
              'pl_050':  50.  ,
              'pl_075':  75.  ,
              'pl_100': 100.  ,
              'pl_125': 125.  ,
              'pl_150': 150.  ,
              'pl_175': 175.  ,
              'pl_200': 200.  ,
              'pl_225': 225.  ,
              'pl_250': 250.  ,
              'pl_275': 275.  ,
              'pl_300': 300.  ,
              'pl_325': 325.  ,
              'pl_350': 350.  ,
              'pl_375': 375.  ,
              'pl_400': 400.  ,
              'pl_425': 425.  ,
              'pl_450': 450.  ,
              'pl_475': 475.  ,
              'pl_500': 500.  ,
              'pl_525': 525.  ,
              'pl_550': 550.  ,
              'pl_575': 575.  ,
              'pl_600': 600.  ,
              'pl_625': 625.  ,
              'pl_650': 650.  ,
              'pl_675': 675.  ,
              'pl_700': 700.  ,
            }
    meshs =  {\
              'NUMEL_060': 60.,
              'NUMEL_080': 80.,
              'NUMEL_120': 120.,
              'NUMEL_160': 160.,
              'NUMEL_200': 200.,
              'NUMEL_240': 240.,
             }
    ccs = {}
    for ccname in ccnames:
        for meshname, numel in meshs.iteritems():
            for ploadname, pltotal in ploads.iteritems():
                cc = std.add_cc_fromDB( ccname )
                cc.numel_r = numel
                cc.meshname = meshname
                cc.ploadconf.ploads = []
                cc.ploadconf.add_pload(
                    theta = 0.,
                    pt = 0.5,
                    pltotal = pltotal )
                cc.axialdispl = 10.
                cc.rebuild()
    std.create_models()
